<?php

require_once('../Connections/petuion.php');
require('../include/simpleHeader.php');

// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['txtLogin'])) {
  $loginUsername=$_POST['txtLogin'];
  $password=$_POST['txtPassword'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "../31RescuePets/Success.php";
  $MM_redirectLoginFailed = "31RescuePetsIndex.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_petuion, $petuion);
  
  $LoginRS__query=sprintf("SELECT UName, UPassword FROM users WHERE UName=%s AND UPassword=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $petuion) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}


$maxRows_Recordset1 = 20;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_petuion, $petuion);
$query_Recordset1 = "SELECT Id, Help_Rule_title, Help_Rule_author, HelpOrRule, SUBSTRING(Help_Rule_info,1,55) AS Help_Rule_info FROM helpandrule WHERE HelpOrRule = '领养须知'";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $petuion) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false && 
        stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>宠物联盟</title>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Geneva, sans-serif;
	font-size: 9pt;
}
#apDiv1 {
	position:absolute;
	left:754px;
	top:1049px;
	width:184px;
	height:89px;
	z-index:1;
	background-color: #F7F7F7;
	visibility: visible;
	overflow: visible;
}
#apDiv2 {
	position:absolute;
	left:559px;
	top:1073px;
	width:201px;
	height:135px;
	z-index:1;
	background-color: #F7F7F7;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_setTextOfTextfield(objId,x,newText) { //v9.0
  with (document){ if (getElementById){
    var obj = getElementById(objId);} if (obj) obj.value = newText;
  }
}
function MM_displayStatusMsg(msgStr) { //v1.0
  window.status=msgStr;
  document.MM_returnValue = true;
}
//-->
</script>
</head>

<body>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="240" align="center" valign="middle"><p><img src="../images/Logo.jpg" width="236" height="107" border="0" /></p></td>
    <td align="left" valign="middle"><p><a href="#">分会介绍</a> | <a href="#">分会活动</a> | <a href="#">宠物新闻</a> | <a href="#">宠物知识</a> | <a href="#">宠物论坛</a> |<a href="#"> 教育乐园</a> | <a href="#">English</a></p>
    <p>&gt; 成功领养案例： 幼猫 XX 只 | 成猫 XX 只 | 幼狗 XX 只 | 成狗 XX 只 | 其他 XX 只</p></td>
    <td align="left" valign="middle"><p>你好, xxx</p>
    <p><a href="#">登出</a></p></td>
  </tr>
  <tr>
    <td width="240">&nbsp;</td>
    <td width="480">&nbsp;</td>
    <td width="80" align="center" valign="middle"><p>&nbsp;</p></td>
  </tr>
  <tr>
    <td width="240"><table width="160" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><p><a href="31RescuePetsIndex.php">救助天地</a><br />
            <a href="32RescuePetsAdopt.php">领养宠物</a><br />
- <a href="321RescuePetsKnown.php">领养须知</a><br />
- <a href="322RescuePetsCat.php">领养猫猫</a><br />
- <a href="323RescuePetsDog.php">领养狗狗</a><br />
<a href="33RescuePetsFamily.php">快乐家庭</a><br />
- <a href="331RescuePetsHappyCat.php">快乐猫猫</a><br />
- <a href="332RescuePetsHappyDog.php">快乐狗狗</a> <br />
<a href="34RescuePetsLost.php">迷路宠物</a><br />
<a href="35RescuePetsFound.php">宠物招领</a><br />
<a href="36RescuePetsRule.php">救助守则</a></p></td>
      </tr>
      <tr>
        <td><br />
          <br /></td>
      </tr>
      <tr>
        <td><br />
          <br /></td>
      </tr>
      <tr>
        <td><br />
          <br /></td>
      </tr>
    </table>
      <table width="160" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>赞助商家<br />            <br /></td>
          <td align="right"><a href="#">更多...</a><br />
          <br /></td>
        </tr>
        <tr>
          <td colspan="2">XXX<br />            <br /></td>
        </tr>
        <tr>
          <td colspan="2"><br />
          <br /></td>
        </tr>
        <tr>
          <td colspan="2"><br />
          <br /></td>
        </tr>
        <tr>
          <td colspan="2"><br />
          <br /></td>
        </tr>
      </table></td>
    <td colspan="2" rowspan="3">
    <p><table  align="center" >
  <tr>
    <td align="center"></td>
    <td align="center"></td>
    <td align="center"></td>
  </tr>
  
  <?php do { ?>
    <tr>
      
      <td><a href="326RescuePetsKnowRule.php?Id=<?php echo $row_Recordset1['Id']; ?>"><?php echo $row_Recordset1['Help_Rule_title']; ?></a></td>
      <td><?php echo $row_Recordset1['Help_Rule_author']; ?> </td>
      <td><?php echo $row_Recordset1['Help_Rule_info'];?>...&nbsp; </td>
      
    </tr>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<br />
<table border="0">
  <tr>
    <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
        <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">First</a>
        <?php } // Show if not first page ?></td>
    <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
        <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a>
        <?php } // Show if not first page ?></td>
    <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
        <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
        <?php } // Show if not last page ?></td>
    <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
        <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a>
        <?php } // Show if not last page ?></td>
  </tr>
</table></p></td>
    </td>
  </tr>
  <tr>
    <td><table width="160" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>友情链接<br />
          <br /></td>
          <td align="right"><a href="#">更多...</a><br />
            <br /></td>
        </tr>
        <tr>
          <td colspan="2">XXX<br />
          <br /></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="160" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td valign="middle">合作伙伴<br />
          <br /></td>
          <td align="right" valign="middle"><a href="#">更多...</a><br />
          <br /></td>
        </tr>
        <tr>
          <td colspan="2">XXX<br /></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="3" align="center" valign="middle">Copyright © 2008 PetUnion 版权所有 不得转载 | <a href="#">站点地图</a> | 沪ICP证XXXXXXX号<br />
    <br /></td>
  </tr>
</table>
</body>
</html>